package com.bookpavilion.chat.pojo;

import com.alibaba.fastjson.annotation.JSONField;
import com.mongodb.util.ObjectSerializer;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Field;

import java.io.Serializable;
import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Message implements Serializable {
    @Id
    private String id;
    private String msg;

    @Indexed
    private Integer status; //0-未读 1-已读  -1 - 删除
    @Field("send_date")
    private Date sendDate;
    @Field("read_date")
    private Date readDate;
    @Indexed
    private User from;
    @Indexed
    private User to;
}
